using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Markup;
using Kotonoha.Server.Settings;

namespace Kotonoha.Server.UI.Converters {
    public class DictionaryStatusProvider {
        public const int CurrentVersion = 1;
        public string Status {
            get {
                if ((bool)(DesignerProperties.IsInDesignModeProperty.GetMetadata(typeof(DependencyObject)).DefaultValue)) {
                    return "Design Time";
                }
                return acquireStatus();
            }
        }

        private string acquireStatus() {
            Setting s = SettingsManager.Acquire("common");
            if (s.GetInt("dic-version", 0) != CurrentVersion) {
                return "Invalid dictionary version";
            }
            return "Ok!";
        }
    }
}